import Vue from "vue";
import App from "./App.vue";
import router from "./router/index.js";
import VueWechatTitle from "vue-wechat-title";
import "bootstrap";
import "bootstrap/dist/css/bootstrap.css";
// 引入iview
import iView from "iview";
import "iview/dist/styles/iview.css";
// 引入公共文件
import VueLazyLoad from "vue-lazyload";
import "./assets/js/rem";
import "./assets/css/style.css";

import VueAwesomeSwiper from "vue-awesome-swiper";
import axios from "axios";
import "swiper/dist/css/swiper.css";
// import vueSeamlessScroll from 'vue-seamless-scroll'
import scroll from "vue-seamless-scroll";
Vue.use(scroll);
Vue.use(iView);
Vue.use(axios);
Vue.use(VueAwesomeSwiper);
Vue.use(VueWechatTitle);
Vue.use(VueLazyLoad, {
  error: "https://jingye.oss-cn-qingdao.aliyuncs.com/lay1.jpg", //报错需要的图片
  loading: "https://jingye.oss-cn-qingdao.aliyuncs.com/lay1.jpg" //替换需要的图片
});

Vue.prototype.base_url = "https://www.jyecloud.cn/";
Vue.config.productionTip = false;
Vue.prototype.ajaxs = (url, obj) => {
  var data = obj.data ? obj.data : {};
  axios({
    method: "POST",
    url: "/inter/" + url,
    data: data,
    headers: {
      "Content-Type": "application/json",
      "x-requested-with": "XMLHttpRequest"
    }
  })
    .then(res => {
      res = res.data;
      obj.success(res);
    })
    .catch(err => {
      obj.error && obj.error();
      // console.log(err)
    })
    .catch(e => {
      ElementUI.Message.error("网络错误");
    });
};
new Vue({
  router,
  render: h => h(App)
}).$mount("#app");
